package com.powerwyx.shortlink.admin.controller;

import com.powerwyx.shortlink.admin.common.convention.result.Result;
import com.powerwyx.shortlink.admin.remote.ShortLinkActualRemoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 王艺锡
 * @version 1.0
 */
@Slf4j
@RestController
public class UrlTitleController {
    @Autowired
    private ShortLinkActualRemoteService shortLinkActualRemoteService;

    /**
     * 根据url获取网站标题
     * @param url
     * @return
     */
    @GetMapping("/api/shortlink/admin/v1/title")
    public Result<String> getTitle(@RequestParam("url") String url){
        return shortLinkActualRemoteService.getTitle(url);
    }
}
